package thesis.database;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;


public class ServiceMapper implements RowMapper<Service> {

	@Override
	public Service mapRow(ResultSet rs, int rowNum) throws SQLException {
		Service service = new Service();
		service.setId(rs.getInt("id"));
		service.setCustomerId(rs.getInt("customer_id"));
		service.setTaxiId(rs.getInt("taxi_id"));
		service.setDistance(rs.getDouble("distance"));
		service.setAcceptTime(rs.getTimestamp("accept_time"));
		service.setBeginLongitude(rs.getString("begin_longitude"));
		service.setBeginLatitude(rs.getString("begin_latitude"));
		service.setEndLongitude(rs.getString("end_longitude"));
		service.setEndLatitude(rs.getString("end_latitude"));
		service.setBeginTime(rs.getTimestamp("begin_time"));
		service.setEndTime(rs.getTimestamp("end_time"));
		service.setBeginAddress(rs.getString("begin_address"));
		service.setEndAddress(rs.getString("end_address"));
		service.setPrice(rs.getDouble("price"));
		service.setStatus(rs.getInt("status"));
		return service;
	}

}
